home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-05 / lanutsrc.zip / CHKHDW.ASM < prev    next >
Assembly Source File  |  1991-03-13  |  2KB  |  66 lines

  1. ;*****************************************************************************
  2. ; Assembly language functions for CHKHDW.ASM
  3. ; 10/29/89
  4. ; 02/18/91 JEM Updated for use w/ MASM 5.1
  5. ;*****************************************************************************
  6. .MODEL COMPACT,C
  7. .CODE
  8.  
  9. ;
  10. ; Name:        cpu_type
  11. ; Function: Returns a number indicating CPU TYPE
  12. ; 86,286 or 386, decimal.
  13. ; Caller:   MSC 4.0, Compact
  14. ; Args:     None
  15. ;        
  16. ; Author:   JM
  17. ; Date:     10/30/89
  18. cpu_type PROC NEAR USES ES DI DS SI
  19.     pushf            ; save flag register contents
  20.     xor    ax,ax        ;
  21.     push    ax        ; save a zero word on the stack
  22.     popf            ; try to set the flag reg to all zeros
  23.     pushf        
  24.     pop    ax        ; get the new flag contents
  25.  
  26.     and    ax,0F000H
  27.     cmp    ax,0F000H       ; did we set bit 15?
  28.     jz    is_808x        ; if not, it's an 8086/8088
  29.     
  30.         mov    ax,07000H       ; see if we can set bits 12-14
  31.         push     ax
  32.         popf            ; try to set the flags again
  33.         pushf
  34.         pop    ax         ; check the results
  35.         and    ax,07000H        
  36.     jz    is_286          ; if we can't set the bits, its an 80286
  37.     
  38.     mov    ax,386        ; otherwise, its an 80386
  39.     jmp    cpu_done
  40.  
  41. is_808x:
  42.     mov    ax,88           ; it's an 8088
  43.     jmp    cpu_done
  44.     
  45. is_286:
  46.     mov    ax,286          ; it's an 80286
  47.         
  48. cpu_done:
  49.     popf            ; restore original flags
  50.         ret
  51. cpu_type ENDP
  52.  
  53. ; Returns TRUE if an FPU is present, FALSE otherwise
  54. fpu_present PROC NEAR USES ES DS SI DI
  55.   int     11h            ; get equipment list
  56.   and    ax,2            ; see if FPU bit is set
  57.   cmp    ax,0
  58.   je    fpu_done        ; if no fpu, then we're done
  59.   mov    ax,1            ; set value to TRUE
  60.   
  61. fpu_done:  
  62.   ret
  63. fpu_present ENDP
  64.  
  65. END
  66.